home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 138
/
Volume 138 Aug 19 2011 - Damaged.iso
/
Games
/
shadez.swf
/
scripts
/
Local
/
Game
/
Thing
/
CPeep.as
< prev
next >
Wrap
Text File
|
2011-08-19
|
10KB
|
326 lines
package Local.Game.Thing
{
import Local.Game.World.CAngle;
import Local.Game.World.CPosition;
import Local.Math.CRandom;
public class CPeep extends CThingSprite
{
public static const mStandHeight:Number = 70 * mSpriteScalar;
public static const mCrouchHeight:Number = 54 * mSpriteScalar;
public static const mProneHeight:Number = 20 * mSpriteScalar;
var mNode:CNode;
var mPrimaryWeapon:CWeapon;
public function CPeep(param1:CPosition)
{
super();
mBaseType = "peep";
mAngle = new CAngle();
mPosition = param1;
mDelta = new CPosition();
mRandom = new CRandom(nID);
zDepth = 200;
mNode = new CNode(mPosition,this);
mNode.mBounce = 0;
mAnimationFrame = Math.random();
mWeaponDelta = new CPosition();
mMaxLife = mLife = 100;
mShowOnMap = true;
MapAdd();
mCollide = new CTCollideHeight(this,30 * mSpriteScalar,mStandHeight);
}
public function State_MOUSEOVER_Enter() : void
{
}
public function State_GOTO_Exit() : void
{
}
public function GetShotDelta(param1:String) : CPosition
{
return mWeaponDelta.Clone();
}
public function State_TARGET_Exit() : void
{
mPrimaryWeapon.mFire = false;
}
public function State_MOUSEOVER_Exit() : void
{
}
public function State_GOTO() : void
{
if(true)
{
§§push(mNode);
if(true)
{
§§push(§§pop().hasTraction);
if(true)
{
if(§§pop())
{
if(true)
{
mAnimationFrame += 0.1;
if(true)
{
Accelerate_Gradient(mDelta,mGradient);
if(true)
{
§§push(mNode);
if(true)
{
§§pop().Move(mDelta);
if(true)
{
§§push(Boolean(mMouseOver));
if(true)
{
if(§§pop())
{
§§pop();
if(true)
{
addr59:
if(mGroupID == GROUPID_FRIEND)
{
if(true)
{
SetState_ReturnAndCount("MOUSEOVER",mStateID,SECONDS / 2);
addr70:
mNode.Update();
addr69:
}
if(!MapMove())
{
}
§§goto(addr78);
}
§§goto(addr69);
}
if(Process_ReachedObjective())
{
§§goto(addr77);
}
else
{
§§goto(addr78);
}
}
}
§§goto(addr59);
}
addr77:
return;
}
§§goto(addr70);
}
§§goto(addr78);
}
§§goto(addr81);
}
§§goto(addr98);
}
§§goto(addr70);
}
§§goto(addr78);
}
addr78:
if(mNode.hasTraction)
{
addr81:
if((mCurrentTarget = GetTarget()) != null)
{
addr98:
SetState("TARGET");
}
§§goto(addr101);
}
addr101:
return;
}
§§goto(addr98);
}
public function State_WAIT() : void
{
if(true)
{
if((mCurrentTarget = GetTarget()) != null)
{
if(true)
{
SetState("TARGET");
if(true)
{
return;
}
addr36:
if(mStateCount < 0)
{
}
§§goto(addr49);
}
SetState("GOTO");
addr49:
return;
}
}
§§goto(addr36);
}
public function State_MOUSEOVER() : void
{
if(true)
{
§§push(mStateCount < 0);
if(mStateCount < 0)
{
§§pop();
if(true)
{
addr28:
if(mMouseOver)
{
}
§§goto(addr32);
}
SetState(mReturnStateID);
addr32:
return;
}
}
§§goto(addr28);
}
public function GetShotPosition(param1:String) : CPosition
{
return GetObjectPosition(param1,mPosition);
}
public function State_TARGET() : void
{
var _loc1_:Object = null;
var _loc2_:CPosition = null;
var _loc3_:CPosition = null;
var _loc4_:Number = NaN;
var _loc5_:Number = NaN;
if(mCurrentTarget.mDead)
{
mStateCount = Math.round((Math.random() * 0.5 + 0.75) * SECONDS);
SetState("WAIT");
return;
}
_loc1_ = mPrimaryWeapon.mAngleRange;
_loc2_ = mCollide.mMid;
_loc3_ = mCurrentTarget.mCollide.mMid;
if(true)
{
mWeaponDelta.SetXY(_loc3_.x - _loc2_.x,_loc3_.y - _loc2_.y);
if(true)
{
_loc4_ = Math.round(mWeaponDelta.GetAngleDEG(mOrientation) * mOrientation);
if(true)
{
mAnimationFrame = 1 - (_loc4_ - _loc1_.min) / (_loc1_.max - _loc1_.min + 1);
if(true)
{
_loc5_ = mWeaponDelta.length / 10 * (1 - mPrimaryWeapon.mAccuracy);
if(true)
{
mWeaponDelta.y += Math.random() * _loc5_ - _loc5_ * 0.5;
}
GetAnimationFrame();
}
mPrimaryWeapon.mFire = true;
}
if(!mPrimaryWeapon.mFired)
{
}
§§goto(addr150);
}
mPrimaryWeapon.mFired = false;
}
addr150:
}
public function State_GOTO_Enter() : void
{
mCollide["mHeight"] = mStandHeight;
SetAnimation("run");
}
override public function Draw() : void
{
super.Draw();
GetAnimationFrame();
DrawSprite(GetOrientationMatrix());
}
public function State_WAIT_Exit() : void
{
}
public function Process_Normal() : void
{
if(Process_State != null)
{
Process_State();
}
Process_Children();
if(mDead)
{
ExplodeSmall();
DispatchDispose();
}
}
public function State_TARGET_Enter() : void
{
if(true)
{
mAnimationFrame = 0.5;
if(true)
{
if(Math.random() >= 0.5)
{
if(true)
{
mCollide["mHeight"] = mCrouchHeight;
SetAnimation("crouchaim");
}
§§goto(addr51);
}
else
{
mCollide["mHeight"] = mStandHeight;
}
§§goto(addr51);
}
SetAnimation("standaim");
}
addr51:
}
public function State_WAIT_Enter() : void
{
if(true)
{
mSpeed = 0;
}
}
}
}